<?php namespace Admin\Controller; 

use Hdphp\Controller\Controller;

//订单管理控制器
class indentController extends CommonController{
	private $model;
	public function __init(){
	    parent::__init();
		//实例化订单表
		$this->model = new \Common\model\indent;
		
	}
	
	//默认
	public function index(){
		//获取订单表数据
		//实例化用户地址表
		$data = $this->model->get();
		foreach ($data as $k => $v) {
			$data[$k]['dz'] = Db::table('user_address')->where("uaid={$v['in_address']}")->pluck('ua_address');
		}
		View::with('data',$data);
		//默认模板
	    View::make();
	}
	
	//订单状态
	public function state(){
		if(IS_POST){
			if(!$this->model->edit()) View::error($this->model->getError());
			View::success('修改成功',U('index'));
		}
		//接收订单id
		$inid = Q('get.inid',0,'intval');
		$oldData = $this->model->where("inid={$inid}")->find();
		View::with('oldData',$oldData);
		//默认模板
	    View::make();
	}
	
}